import { defineStore } from 'pinia'

export const useMpUser = defineStore('mpUser', {
	state: () => ({
		mpUser: {}
	}),
	getters: {
		getMpUser: (state) => state.mpUser
	},
	actions: {
		updateMpUser(newMpUser) {
			this.mpUser = Object.assign(this.mpUser, newMpUser)
			console.log('mpUser:', this.mpUser)
		}
	},
	storeOptions: {
		openStorage: true,
		storageWay: {
			setStorageWay: (key, data) => uni.setStorageSync(key, data), // 这里将存储方法替换
			getStorageWay: (key) => uni.getStorageSync(key)
		},
		paths: ['mpUser']
	}
})
